package city.spring.modules.material.vo;

import city.spring.action.model.AbstractMaterialWarehousingMaterial;
import city.spring.modules.material.entity.MaterialdeliveryMaterialExtEntity;
import city.spring.modules.material.entity.MaterialwarehousingMaterialExtEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.Date;

/**
 * @author 谢金婷
 * @date 2020/7/17 0004 16:48
 * @see MaterialdeliveryMaterialExtEntity
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class MaterialwarehousingMaterialVO extends MaterialwarehousingMaterialExtEntity {

    /**
     * 物资类别
     */
    private String cname;

    /**
     * 物资名称
     */
    private String name;
    /**
     * 供应商名称
     */
    private String suppliername;

    /**
     * 入库单
     */
    private String warehouseId;

    /**
     * 转换成出库时所需要的对象
     *
     * @return AbstractPlanUser
     */
    public AbstractMaterialWarehousingMaterial<MaterialwarehousingMaterialVO> toWarehousingShelflevel() {
        MaterialwarehousingMaterialVO item = this;
        return new AbstractMaterialWarehousingMaterial<MaterialwarehousingMaterialVO>() {

            @Override
            public Object getKey() {
                return item.getMaterialId();
            }

            @Override
            public String getCname() {
                return item.getCname();
            }

            @Override
            public String getName() {
                return item.getName();
            }

            @Override
            public String getSuppliername() {
                return item.getSuppliername();
            }

            @Override
            public Object getMaterialwarehousingId() {
                return item.getMaterialwarehousingId();
            }

            @Override
            public Object getSupplierId() {
                return item.getSupplierId();
            }

            @Override
            public BigDecimal getWarehousingquantity() {
                return item.getWarehousingquantity();
            }

            @Override
            public BigDecimal getUnitprice() {
                return item.getUnitprice();
            }

            @Override
            public BigDecimal getTotal() {
                return item.getTotal();
            }

            @Override
            public Date getExpirationdate() {
                return item.getExpirationdate();
            }

            @Override
            public Date getProductiondate() {
                return item.getProductiondate();
            }

            @Override
            public Object getSpecifications() {
                return item.getSpecifications();
            }


            @Override
            public MaterialwarehousingMaterialVO getObject() {
                return item;
            }
        };
    }
}
